package com.ae.shield.common.recipe.conditions;

import com.ae.shield.ModLib;
import com.ae.shield.common.config.Config;
import com.google.gson.JsonObject;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.crafting.conditions.ICondition;
import net.minecraftforge.common.crafting.conditions.IConditionSerializer;

public class ConfigMetalProcessingCondition implements ICondition {
    public static final ConfigMetalProcessingCondition INSTANCE = new ConfigMetalProcessingCondition();
    private static final ResourceLocation NAME = new ResourceLocation(ModLib.MOD_ID, "config_metal_processing");

    private ConfigMetalProcessingCondition() {
    }

    @Override
    public ResourceLocation getID() {
        return NAME;
    }

    @Override
    public boolean test() {
        return Config.METAL_PROCESSING.get();
    }

    @Override
    public String toString() {
        return "config_metal_processing";
    }

    public static class Serializer implements IConditionSerializer<ConfigMetalProcessingCondition> {
        public static final ConfigMetalProcessingCondition.Serializer INSTANCE = new ConfigMetalProcessingCondition.Serializer();

        @Override
        public void write(JsonObject json, ConfigMetalProcessingCondition value) {
        }

        @Override
        public ConfigMetalProcessingCondition read(JsonObject json) {
            return ConfigMetalProcessingCondition.INSTANCE;
        }

        @Override
        public ResourceLocation getID() {
            return ConfigMetalProcessingCondition.NAME;
        }
    }
}
